#需要拿到 节点是否通 是否有80端口  0代表通  1代表不通

import os
import socket
from paramiko import SSHClient,AutoAddPolicy
#查看IP

def pings(ip):
    os.system('chcp 65001')
    cmd = f"ping -n 1 -w 1 {ip}"
    exit_code = os.system(cmd)
    # print(exit_code)
    return exit_code


#端口
def is_port_open(ip, port, timeout=1):
    try:
        sock = socket.create_connection((ip, port), timeout=timeout)
        sock.close()
        return 0
    except socket.error:
        return 1





# 检查本机的80端口
# ip = '192.168.10.11'
# port = 3306
#
# print(is_port_open(ip, port))

#
# p = pings('192.168.10.14')  #是否通ip
#
# print(p)
